package hnlg.com.cn.junit;

import javax.annotation.Resource;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import hnlg.com.cn.service.UnitService;
import hnlg.com.cn.vo.Unit;

@SpringBootTest
@RunWith(SpringRunner.class)
public class UnitServiceImplTest {

	@Resource UnitService unitService;
	
	@Test
	public void testaddUnit() throws Exception {
		Unit unit = new Unit();
		unit.setName("3单元");
		unitService.addUnit(unit);
	}

	@Test
	public void testdeleteUnit()throws Exception{
		unitService.deleteUnit(2);
	}
	
	@Test
	public void testUpdateUnit()throws Exception{
		Unit unit = new Unit();
		unit.setName("7单元");
		unit.setId(4);
		unitService.updateUnit(unit);
	}
	
	@Test
	public void testQueryUnit()throws Exception{
		Unit unit =new Unit();
		unitService.queryUnit(unit);
					
	}
	
	@Test
	public void testDeleteBatch()throws Exception{
		String arr[]={"1","4"};
		boolean flag = unitService.deleteBatch(arr);
		System.out.println("flag="+flag);
	}
}
